<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false"%>
<html>
<head>
    <title>运单管理</title>
    <style>
        .table-responsive{
            overflow: auto; width: 100%;
        }
        .table {
            white-space: nowrap;
            overflow:scroll;
            width: inherit;
        }
        .table td {
            white-space: nowrap;
            text-overflow: ellipsis;
        }
    </style>
</head>
<body>
    <div ng-app="myApp" ng-controller="LogisticsCtrl">
        <div class="row">
            <ui-container url="system/logistics/list" key="logistics-list-00">
                <ui-search-form>
                    <search-date format="yyyy-mm" class="col-md-3" name="month" placeholder="请输入订单完结所在月份" value= "{{dateValue}}" ></search-date>
                    <search-date format="yyyy-mm-dd" class="col-md-3" name="startTime" id="startTime" placeholder="订单签收时间段开始时间" ></search-date>
                    <search-date format="yyyy-mm-dd" class="col-md-3" name="endTime" id="endTime" placeholder="订单签收时间段结束时间" ></search-date>
                    <search-input class="col-md-3" name="waybillNum" placeholder="请输入运单号"></search-input>
                    <search-input class="col-md-3" name="businessCode" placeholder="请输订单号"></search-input>
                    <search-input class="col-md-3" name="postmanNo" placeholder="请输入配送员工工号"></search-input>
                    <search-input class="col-md-3" name="postmanName" placeholder="请输入配送员姓名"></search-input>
                    <search-select-remote
                            class = "col-md-3"
                            url = "system/supplier/listall"
                            label = "供货商:"
                            name = "supplierCode"
                            placeholder = "请选择供应商"
                            value-name = "code"
                            text-name = "name">
                    </search-select-remote>
                    <search-input class="col-md-3" name="orgnameDelivery" placeholder="请输入配送站点名称"></search-input>
                    <search-input class="col-md-3" name="nameConsignee" placeholder="请输入签收人姓名"></search-input>
                    <search-input class="col-md-3" name="mobileConsignee" placeholder="请输入签收人手机号"></search-input>
                    <search-select class="col-md-3" name="direction" >
                        <option value="">请选择配送类型</option>
                        <option value="0">配送</option>
                        <option value="1">上门换</option>
                        <option value="2">上门退</option>
                    </search-select>
                </ui-search-form>
                <ui-table-tool>
                    <a class="btn btn-sm btn-primary" href="javascript:void(0);" onclick="reSet()">重置</a>
                </ui-table-tool>
                <ui-table>
                    </ui-form>
                </ui-table>
                <table-page/>
            </ui-container>
        </div>
    </div>
<script>
    angular.module('myApp',['ui.table']);
    angular.module('myApp').controller('LogisticsCtrl', function($scope){
        $scope.dateValue=new Date().format("yyyy-MM");

        $scope.addOrg = function (items) {
            console.info(items)
        }
        //每一列的操作按钮
//        $scope._operateColumns=[{text:'编辑',click:function (data) {
//            window.open("system/logistics/update?id="+data.id+"&signTime="+data.signTime,"_target");
//        }},{text:'详情',click:function (data) {
//            window.open("system/logistics/detail.htm?id="+data.id,"_target");
//        }}]
        //每一列的操作按钮
        $scope._operateColumns=[{text:'详情',click:function (data) {
            window.open("system/logistics/detail.htm?id="+data.id+"&signTime="+data.signTime,"_target");
        }}]

        $scope._columns=[ {name:'id',head:'id'},
            {name:'waybillNum',head:'运单号'},
            {name:'businessCode',head:'订单号'},
            {name:'acceptScheduled',head:'应揽收时间'},
            {name:'accept',head:'入库'},
            {name:'acceptTime',head:'入库时间',render(data,value){
                return value == null ? '': new Date(value).format("yyyy-MM-dd hh:mm:ss");
            }},
            {name:'warehouseOut',head:'出库',render(data,value){
                return value == 0 ?'否':'是' ;
            }},
            {name:'warehouseOutTime',head:'出库时间',render(data,value){
                return value == null ? '': new Date(value).format("yyyy-MM-dd hh:mm:ss");
            }},
            {name:'siteIn',head:'到站',render(data,value){
                return value == 0 ?'否':'是' ;
            }},
            {name:'siteInTime',head:'到站时间',render(data,value){
                return value == null ?'':new Date(value).format("yyyy-MM-dd hh:mm:ss");
            }},
            {name:'siteOut',head:'出站'},
            {name:'siteOutTime',head:'出站时间',render(data,value){
                return value == 0 ?'否':'是' ;
            }},
            {name:'signTimePromised',head:'承诺送达时间',render(data,value){
                return value == null?'':new Date(value).format("yyyy-MM-dd hh:mm:ss")
            }},
            {name:'provinceConsignee',head:'省',render(data,value){
                return (data.provinceConsignee && data.provinceConsignee.name) ? data.provinceConsignee.name:"";
            }},
            {name:'cityConsignee',head:'市',render(data,value){
                return (data.cityConsignee && data.cityConsignee.name) ? data.cityConsignee.name:"";
            }},
            {name:'countyConsignee',head:'区',render(data,value){
                return (data.countyConsignee && data.countyConsignee.name) ? data.countyConsignee.name:"";
            }},
            {name:'addressConsignee',head:'收件人地址'},
            {name:'mobileConsignee',head:'收件人号码'},
            {name:'direction',head:'配送类型',render(data,value){
                switch (value + ""){
                    case "0" :
                        return "配送";
                    case "1" :
                        return "上门换";
                    case "2" :
                        return "上门退";
                    default : return "未知";
                }

            }},
            {name:'temperature',head:'运输温度等级',render(data,value){
                switch (value+""){
                    case "0" :
                        return "常温";
                    case "1" :
                        return "生鲜冷链";
                    default : return "";
                }
            }},
            {name:'expressScheduleType',head:'配送时效要求',render(data,value){
                switch (value+""){
                    case "0" :
                        return "未知";
                    case "1" :
                        return "当日达";
                    case "2" :
                        return "次晨达";
                    case "3" :
                        return "三日达";
                    case "4" :
                        return "工作日";
                    case "5" :
                        return "节假日";
                    case "6" :
                        return "夜间配";
                    case "7" :
                        return "上午达";
                    case "8" :
                        return "下午达";
                    default : return "";
                }

            }},
            {name:'packageSize',head:'包裹大小规格',render(data,value){
                switch (value + ""){
                    case "0" :
                        return "未知";
                    case "1" :
                        return "小件";
                    case "2" :
                        return "大件";
                    default : return "";

                }
            }},
            {name:'expensive',head:'贵品',render(data,value){
                return value == '0'?'否':'是'
            }},
            {name:'weight',head:'包裹重量'},
            {name:'volume',head:'包裹体积'},
            {name:'length',head:'包裹长度'},
            {name:'width',head:'包裹宽度'},
            {name:'height',head:'包裹高度'},
            {name:'importSource',head:'运单来源',render(data,value){
               return value==0?'系统接入':'手工导入';
            }},
            {name:'supplierName',head:'供货商',render(data,value){
                return (data.supplier && data.supplier.name) ? data.supplier.name : "";
            }},
            {name:'supplierWarehouse',head:'供货商发货仓库'},
            {name:'nameConsignee',head:'收件人姓名'},
            {name:'cod',head:'代收货款'},
            {name:'codBack',head:'代退货款'},
            {name:'orderAmount',head:'订单价格'},
            {name:'sendNum',head:'发货数量'},
            {name:'postmanNo',head:'配送员工号'},
            {name:'orgAccept',head:'导入机构',render(data,value){
                return (data.orgAccept && data.orgAccept.name) ? data.orgAccept.name : "";
            }},
            {name:'orgCurrent',head:'当前机构',render(data,value){
                return (data.orgCurrent && data.orgCurrent.name) ? data.orgCurrent.name : "";
            }},
            {name:'orgDelivery',head:'实际配送站点',render(data,value){
                return (data.orgDelivery && data.orgDelivery.name) ? data.orgDelivery.name : "";
            }},
            {name:'orgTarget',head:'匹配站点',render(data,value){
                return (data.orgTarget&&data.orgTarget.name)?data.orgTarget.name : "";
            }},
            {name:'status',head:'配送状态',render(data,value){
                switch (value + ""){
                    case "0" :
                        return "配送中";
                    case "1" :
                        return "配送成功";
                    case "2" :
                        return "配送失败";
                    default : return"";
                }
            }},
//            {name:'nodeCurrent',head:'运单流转节点',render(data,value){
//                switch (value+""){
//                    case "000" :
//                        return "系统导入";
//                    case "001" :
//                        return "人工导入";
//                    case "101" :
//                        return "仓库入库";
//                    case "102" :
//                        return "仓库出库";
//                    case "103" :
//                        return "中转入库";
//                    case "104" :
//                        return "中转出库";
//                    case "105" :
//                        return "退货入库";
//                    case "106" :
//                        return "退货出库";
//                    case "105" :
//                        return "返单入库";
//                    case "106" :
//                        return "返单出库";
//                    case "107" :
//                        return "退商家出库";
//                    case "108" :
//                        return "退商拒收返库";
//                    case "109" :
//                        return "退商家成功";
//                    case "110" :
//                        return "反库入库";
//                    case "200" :
//                        return "站点入站";
//                    case "201" :
//                        return "中转入站";
//                    case "202" :
//                        return "滞留入站";
//                    case "203" :
//                        return "配送出站";
//                    case "204" :
//                        return "中转出站";
//                    case "205" :
//                        return "退货出站";
//                    case "206" :
//                        return "退货入站";
//                    case "207" :
//                        return "退商家出站";
//                    case "208" :
//                        return "返单出站";
//                    case "209" :
//                        return "返单入站";
//                    case "210" :
//                        return "订单签收";
//                    case "211" :
//                        return "订单拒收";
//                    case "300" :
//                        return "订单丢失";
//                    default : return "";
//                }
//            }},
            {name:'signTime',head:'运单签收时间',render(data,value){
                return value == null ? '': new Date(value).format("yyyy-MM-dd hh:mm:ss");
            }},
            {name:'guaranteeFee',head:'保费'},
            {name:'signer',head:'本人签收',render(data,value){
                return value == 0 ? '否':'是';
            }},
            {name:'businessRemark',head:'供货商备注'},
            {name:'remark',head:'运单备注'}
        ];
    });

    function reSet() {
        var reSetObj = $('input');
        var selectObj = $('select');
        reSetObj.val("");
        selectObj.val("");
    }

</script>
</body>
</html>
